// HookCalcProcess.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <atlconv.h>
#include "DebugLog.h"

using namespace std;

HWND GetCurrentWindow()
{
	//if(g_App == NULL)
	//{
	//	DebugLog("g_App = NULL!");
	//	return NULL;
	//}

	HWND hCurCld = NULL; 
	//try
	//{
	//	CComPtr<Excel::Window> pDocWin;
	//	g_App->get_ActiveWindow(&pDocWin);
	//	hCurCld = (HWND)pDocWin->GetHwnd();
	//}
	//catch(...)
	//{
	//	ErrorLog("Exception Catch!");
	//	return NULL;
	//}

	return hCurCld;
}

WCHAR *GetExecutable(LPCWSTR lpFile)
{
	USES_CONVERSION;

	static WCHAR szExecutable[MAX_PATH * 2];
	ZeroMemory(szExecutable, MAX_PATH * 2);
	
	if((DWORD)FindExecutableW(lpFile, NULL, (LPWSTR)szExecutable) <= 32)
	{
	//	DBGOUT("GetExecutable() fn FindExecutable FAIL[%s]", W2T(lpFile));
		return NULL;
	}
	return szExecutable;
} 

int _tmain(int argc, _TCHAR* argv[])
{

	HWND hwdnBtn9;
	HWND hwdnCalc;
	HINSTANCE hInstCalc;
	hwdnCalc = FindWindowW(L"CalculatorClass",NULL);

	if(hwdnCalc) {
		cout<<"found Calculator.exe\n";

		hwdnBtn9 = FindWindowEx(hwdnCalc, NULL, NULL, "-" );
		if(hwdnBtn9) {
			EnableWindow(hwdnBtn9, FALSE);
			OutputLog(LogLevelDebug, "%s,%d,%s,hWnd[%p] is No Style Window.", __FILE__, __LINE__, __FUNCTION__);
		}
	}

	return 0;
}

